//
//  CommonGoodItemCell.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/10/27.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "CommonGoodCell.h"

#import "TransmitListData.h"

@interface CommonGoodCell ()

/// viewModle
@property (nonatomic, readwrite, strong) CommonGoodCellModel *viewModel;

/// IBOutlet
@property (weak, nonatomic) IBOutlet UILabel* titleLabel;
@property (weak, nonatomic) IBOutlet UILabel* timeLabel;
@property (weak, nonatomic) IBOutlet UIImageView* imgView;

@end

@implementation CommonGoodCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

#pragma mark - bind data
- (void)bindViewModel:(CommonGoodCellModel *)viewModel
{
    self.viewModel = viewModel;
    
    TransmitListData* tListData = viewModel.data;
    
    self.titleLabel.text = tListData.user.wxNickName;
    self.timeLabel.text = tListData.addTime;
    
    [self.imgView yy_setImageWithURL:[NSURL URLWithString:tListData.user.wxHeadImg] placeholder:MHImageNamed(@"placeholderLogo")];
    
    @weakify(self);
    [[[self rac_signalForSelector:@selector(layoutSubviews)] takeUntil:[self rac_prepareForReuseSignal]] subscribeNext:^(id x)
    {
        @strongify(self);
        
        self.imgView.layer.cornerRadius = self.imgView.frame.size.height/2.0f;
        self.imgView.layer.masksToBounds = YES;
    }];
}

@end
